sub

pure function sub(start: integer): list<T>

Returns a sublist of this list starting from the specified index (inclusive).

Equivalent to list.sub(index, list.size()).

Note that:

  • my_list.sub(my_list.size() - 1) returns a list containing only the last element of my_list (assuming my_list.size > 0)

  • my_list.sub(my_list.size()) returns an empty list

  • my_list.sub(my_list.size() + 1) throws an exception

Since

0.6.0

Parameters

start

the starting index of the sublist (inclusive)

Throws

exception

if the start index greater than this list's size


pure function sub(start: integer, end: integer): list<T>

Returns a sublist of this list starting from the specified start index (inclusive) to the specified end index (exclusive).

For the list my_list, my_list.sub(start, my_list.size()) is equivalent to my_list.sub(start).

Since

0.6.0

Parameters

start

the start index of the sublist (inclusive)

end

the end index of the sublist (exclusive)

Throws

exception

when:

  • the start or end indexes are greater than this list's size

  • the start index is greater than the end index